<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('category', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('pid')->default(0)->comment('上级分类id');
            $table->string('cate_name', 30)->default('')->comment('分类名称');
            $table->string('cate_desc')->default('')->comment('商品分类描述');
            $table->string('path', 100)->default('0,')->comment('分类路径');
            $table->integer('cate_sort')->default(0)->comment('排序');
            $table->tinyInteger('cate_isnav')->default(0)->comment('是否显示在导航栏');
            $table->tinyInteger('cate_status')->default(1)->comment('分类状态，1开启0隐藏-1删除');
            $table->index('pid');
            $table->index('cate_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('category');
    }
}
